package com.frame.app.backstage.rms.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.frame.app.core.rms.model.SystemUser;


@Controller
public class UserController {
	@RequestMapping("/userList")
	public String userList(HttpServletRequest request, HttpServletResponse response,ModelMap model) throws Exception {
		SystemUser user = new SystemUser();
		user.setPage(1);
		user.setPerPageSize(50);
		List<SystemUser> userList = user.find();
		model.addAttribute("userList",userList);
		return "backstage/rms/user/userList";
	}
	
	@RequestMapping(value="/userListJson")
	@ResponseBody
	public Map<String,Object> userListJson(HttpServletRequest request, HttpServletResponse response,ModelMap model) throws Exception {
		SystemUser user = new SystemUser();
		user.setPage(1);
		user.setPerPageSize(50);
		List<SystemUser> userList = user.find();
		Map<String,Object> map= new HashMap<String,Object>();
		map.put("total",userList.size());
		map.put("rows",userList);
		//Object o = appCommonService.callApp("Wcm_StoreManageServiceImpl", "selectThemesByChannelId", new Object[]{1L});
	    return map;
	}
}
